Relax overly strict asserts in dependency queue
authorAlex Crichton <alex@alexcrichton.com>
Thu, 13 Apr 2017 21:40:08 +0000 (14:40 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Wed, 26 Apr 2017 14:09:14 +0000 (07:09 -0700)
Don't actually need to assert that these are unique, it works both ways and we
can have flavorful dependency graphs which otherwise trigger the assertions.

Closes #3902

src/cargo/util/dependency_queue.rs
tests/test.rs

index 1514585d960db6e1915c7b4ea5cfb7cbb0675251..1b054428b6565cd542a6ff2332fd21ac3e30229f 100644 (file)
@@ -83,10 +83,10 @@ impl<K: Hash + Eq + Clone, V> DependencyQueue<K, V> {
 
         let mut my_dependencies = HashSet::new();
         for dep in dependencies {
-            assert!(my_dependencies.insert(dep.clone()));
+            my_dependencies.insert(dep.clone());
             let rev = self.reverse_dep_map.entry(dep.clone())
                                           .or_insert_with(HashSet::new);
-            assert!(rev.insert(key.clone()));
+            rev.insert(key.clone());
         }
         &mut slot.insert((my_dependencies, value)).1
     }
index 94ac33a0095cc53af42d86fd32aeb993aa2a6ba7..fbbf02667e19a9b232f284f065795d4d23ea803b 100644 (file)
@@ -3005,3 +3005,25 @@ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured
 "));
 
 }
+
+#[test]
+fn cyclic_dev() {
+   let p = project("foo")
+        .file("Cargo.toml", r#"
+            [project]
+            name = "foo"
+            version = "0.1.0"
+
+            [dev-dependencies]
+            foo = { path = "." }
+        "#)
+        .file("src/lib.rs", r#"
+            #[test] fn test_lib() {}
+        "#)
+        .file("tests/foo.rs", r#"
+            extern crate foo;
+        "#);
+
+    assert_that(p.cargo_process("test").arg("--all"),
+                execs().with_status(0));
+}